3.234 \(\int \frac{\cot ^2(e+f x)}{(a+b \tan ^2(e+f x))^2} \, dx\)

Optimal. Leaf size=128 \[ \frac{b^{3/2} (5 a-3 b) \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{2 a^{5/2} f (a-b)^2}-\frac{(2 a-3 b) \cot (e+f x)}{2 a^2 f (a-b)}-\frac{b \cot (e+f x)}{2 a f (a-b) \left (a+b \tan ^2(e+f x)\right )}-\frac{x}{(a-b)^2} \]

[Out]

-(x/(a - b)^2) + ((5*a - 3*b)*b^(3/2)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(2*a^(5/2)*(a - b)^2*f) - ((2*a
- 3*b)*Cot[e + f*x])/(2*a^2*(a - b)*f) - (b*Cot[e + f*x])/(2*a*(a - b)*f*(a + b*Tan[e + f*x]^2))

________________________________________________________________________________________

Rubi [A]  time = 0.191909, antiderivative size = 128, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.261, Rules used = {3670, 472, 583, 522, 203, 205} \[ \frac{b^{3/2} (5 a-3 b) \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{2 a^{5/2} f (a-b)^2}-\frac{(2 a-3 b) \cot (e+f x)}{2 a^2 f (a-b)}-\frac{b \cot (e+f x)}{2 a f (a-b) \left (a+b \tan ^2(e+f x)\right )}-\frac{x}{(a-b)^2} \]

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]^2/(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-(x/(a - b)^2) + ((5*a - 3*b)*b^(3/2)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(2*a^(5/2)*(a - b)^2*f) - ((2*a
- 3*b)*Cot[e + f*x])/(2*a^2*(a - b)*f) - (b*Cot[e + f*x])/(2*a*(a - b)*f*(a + b*Tan[e + f*x]^2))

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rule 472

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> -Simp[(b*(e*x
)^(m + 1)*(a + b*x^n)^(p + 1)*(c + d*x^n)^(q + 1))/(a*e*n*(b*c - a*d)*(p + 1)), x] + Dist[1/(a*n*(b*c - a*d)*(
p + 1)), Int[(e*x)^m*(a + b*x^n)^(p + 1)*(c + d*x^n)^q*Simp[c*b*(m + 1) + n*(b*c - a*d)*(p + 1) + d*b*(m + n*(
p + q + 2) + 1)*x^n, x], x], x] /; FreeQ[{a, b, c, d, e, m, q}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[p
, -1] && IntBinomialQ[a, b, c, d, e, m, n, p, q, x]

Rule 583

Int[((g_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.)*((e_) + (f_.)*(x_)^(n_)),
x_Symbol] :> Simp[(e*(g*x)^(m + 1)*(a + b*x^n)^(p + 1)*(c + d*x^n)^(q + 1))/(a*c*g*(m + 1)), x] + Dist[1/(a*c*
g^n*(m + 1)), Int[(g*x)^(m + n)*(a + b*x^n)^p*(c + d*x^n)^q*Simp[a*f*c*(m + 1) - e*(b*c + a*d)*(m + n + 1) - e
*n*(b*c*p + a*d*q) - b*e*d*(m + n*(p + q + 2) + 1)*x^n, x], x], x] /; FreeQ[{a, b, c, d, e, f, g, p, q}, x] &&
 IGtQ[n, 0] && LtQ[m, -1]

Rule 522

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

\begin{align*} \int \frac{\cot ^2(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx &=\frac{\operatorname{Subst}\left (\int \frac{1}{x^2 \left (1+x^2\right ) \left (a+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{b \cot (e+f x)}{2 a (a-b) f \left (a+b \tan ^2(e+f x)\right )}+\frac{\operatorname{Subst}\left (\int \frac{2 a-3 b-3 b x^2}{x^2 \left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{2 a (a-b) f}\\ &=-\frac{(2 a-3 b) \cot (e+f x)}{2 a^2 (a-b) f}-\frac{b \cot (e+f x)}{2 a (a-b) f \left (a+b \tan ^2(e+f x)\right )}-\frac{\operatorname{Subst}\left (\int \frac{2 a^2+2 a b-3 b^2+(2 a-3 b) b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{2 a^2 (a-b) f}\\ &=-\frac{(2 a-3 b) \cot (e+f x)}{2 a^2 (a-b) f}-\frac{b \cot (e+f x)}{2 a (a-b) f \left (a+b \tan ^2(e+f x)\right )}-\frac{\operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{(a-b)^2 f}+\frac{\left ((5 a-3 b) b^2\right ) \operatorname{Subst}\left (\int \frac{1}{a+b x^2} \, dx,x,\tan (e+f x)\right )}{2 a^2 (a-b)^2 f}\\ &=-\frac{x}{(a-b)^2}+\frac{(5 a-3 b) b^{3/2} \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{2 a^{5/2} (a-b)^2 f}-\frac{(2 a-3 b) \cot (e+f x)}{2 a^2 (a-b) f}-\frac{b \cot (e+f x)}{2 a (a-b) f \left (a+b \tan ^2(e+f x)\right )}\\ \end{align*}

Mathematica [A]  time = 2.79902, size = 117, normalized size = 0.91 \[ \frac{\frac{b^{3/2} (5 a-3 b) \tan ^{-1}\left (\frac{\sqrt{b} \tan (e+f x)}{\sqrt{a}}\right )}{a^{5/2} (a-b)^2}+\frac{\frac{b^2 (a-b) \sin (2 (e+f x))}{a^2 ((a-b) \cos (2 (e+f x))+a+b)}-2 (e+f x)}{(a-b)^2}-\frac{2 \cot (e+f x)}{a^2}}{2 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]^2/(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(((5*a - 3*b)*b^(3/2)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(a^(5/2)*(a - b)^2) - (2*Cot[e + f*x])/a^2 + (-2
*(e + f*x) + ((a - b)*b^2*Sin[2*(e + f*x)])/(a^2*(a + b + (a - b)*Cos[2*(e + f*x)])))/(a - b)^2)/(2*f)

________________________________________________________________________________________

Maple [A]  time = 0.087, size = 187, normalized size = 1.5 \begin{align*} -{\frac{1}{f{a}^{2}\tan \left ( fx+e \right ) }}+{\frac{{b}^{2}\tan \left ( fx+e \right ) }{2\,f \left ( a-b \right ) ^{2}a \left ( a+b \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) }}-{\frac{{b}^{3}\tan \left ( fx+e \right ) }{2\,f{a}^{2} \left ( a-b \right ) ^{2} \left ( a+b \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) }}+{\frac{5\,{b}^{2}}{2\,f \left ( a-b \right ) ^{2}a}\arctan \left ({b\tan \left ( fx+e \right ){\frac{1}{\sqrt{ab}}}} \right ){\frac{1}{\sqrt{ab}}}}-{\frac{3\,{b}^{3}}{2\,f{a}^{2} \left ( a-b \right ) ^{2}}\arctan \left ({b\tan \left ( fx+e \right ){\frac{1}{\sqrt{ab}}}} \right ){\frac{1}{\sqrt{ab}}}}-{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) }{f \left ( a-b \right ) ^{2}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)^2/(a+b*tan(f*x+e)^2)^2,x)

[Out]

-1/f/a^2/tan(f*x+e)+1/2/f/(a-b)^2*b^2/a*tan(f*x+e)/(a+b*tan(f*x+e)^2)-1/2/f*b^3/a^2/(a-b)^2*tan(f*x+e)/(a+b*ta
n(f*x+e)^2)+5/2/f/(a-b)^2*b^2/a/(a*b)^(1/2)*arctan(b*tan(f*x+e)/(a*b)^(1/2))-3/2/f*b^3/a^2/(a-b)^2/(a*b)^(1/2)
*arctan(b*tan(f*x+e)/(a*b)^(1/2))-1/f/(a-b)^2*arctan(tan(f*x+e))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2/(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.68502, size = 1142, normalized size = 8.92 \begin{align*} \left [-\frac{8 \, a^{2} b f x \tan \left (f x + e\right )^{3} + 8 \, a^{3} f x \tan \left (f x + e\right ) + 8 \, a^{3} - 16 \, a^{2} b + 8 \, a b^{2} + 4 \,{\left (2 \, a^{2} b - 5 \, a b^{2} + 3 \, b^{3}\right )} \tan \left (f x + e\right )^{2} +{\left ({\left (5 \, a b^{2} - 3 \, b^{3}\right )} \tan \left (f x + e\right )^{3} +{\left (5 \, a^{2} b - 3 \, a b^{2}\right )} \tan \left (f x + e\right )\right )} \sqrt{-\frac{b}{a}} \log \left (\frac{b^{2} \tan \left (f x + e\right )^{4} - 6 \, a b \tan \left (f x + e\right )^{2} + a^{2} - 4 \,{\left (a b \tan \left (f x + e\right )^{3} - a^{2} \tan \left (f x + e\right )\right )} \sqrt{-\frac{b}{a}}}{b^{2} \tan \left (f x + e\right )^{4} + 2 \, a b \tan \left (f x + e\right )^{2} + a^{2}}\right )}{8 \,{\left ({\left (a^{4} b - 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} f \tan \left (f x + e\right )^{3} +{\left (a^{5} - 2 \, a^{4} b + a^{3} b^{2}\right )} f \tan \left (f x + e\right )\right )}}, -\frac{4 \, a^{2} b f x \tan \left (f x + e\right )^{3} + 4 \, a^{3} f x \tan \left (f x + e\right ) + 4 \, a^{3} - 8 \, a^{2} b + 4 \, a b^{2} + 2 \,{\left (2 \, a^{2} b - 5 \, a b^{2} + 3 \, b^{3}\right )} \tan \left (f x + e\right )^{2} -{\left ({\left (5 \, a b^{2} - 3 \, b^{3}\right )} \tan \left (f x + e\right )^{3} +{\left (5 \, a^{2} b - 3 \, a b^{2}\right )} \tan \left (f x + e\right )\right )} \sqrt{\frac{b}{a}} \arctan \left (\frac{{\left (b \tan \left (f x + e\right )^{2} - a\right )} \sqrt{\frac{b}{a}}}{2 \, b \tan \left (f x + e\right )}\right )}{4 \,{\left ({\left (a^{4} b - 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} f \tan \left (f x + e\right )^{3} +{\left (a^{5} - 2 \, a^{4} b + a^{3} b^{2}\right )} f \tan \left (f x + e\right )\right )}}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2/(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

[-1/8*(8*a^2*b*f*x*tan(f*x + e)^3 + 8*a^3*f*x*tan(f*x + e) + 8*a^3 - 16*a^2*b + 8*a*b^2 + 4*(2*a^2*b - 5*a*b^2
 + 3*b^3)*tan(f*x + e)^2 + ((5*a*b^2 - 3*b^3)*tan(f*x + e)^3 + (5*a^2*b - 3*a*b^2)*tan(f*x + e))*sqrt(-b/a)*lo
g((b^2*tan(f*x + e)^4 - 6*a*b*tan(f*x + e)^2 + a^2 - 4*(a*b*tan(f*x + e)^3 - a^2*tan(f*x + e))*sqrt(-b/a))/(b^
2*tan(f*x + e)^4 + 2*a*b*tan(f*x + e)^2 + a^2)))/((a^4*b - 2*a^3*b^2 + a^2*b^3)*f*tan(f*x + e)^3 + (a^5 - 2*a^
4*b + a^3*b^2)*f*tan(f*x + e)), -1/4*(4*a^2*b*f*x*tan(f*x + e)^3 + 4*a^3*f*x*tan(f*x + e) + 4*a^3 - 8*a^2*b +
4*a*b^2 + 2*(2*a^2*b - 5*a*b^2 + 3*b^3)*tan(f*x + e)^2 - ((5*a*b^2 - 3*b^3)*tan(f*x + e)^3 + (5*a^2*b - 3*a*b^
2)*tan(f*x + e))*sqrt(b/a)*arctan(1/2*(b*tan(f*x + e)^2 - a)*sqrt(b/a)/(b*tan(f*x + e))))/((a^4*b - 2*a^3*b^2
+ a^2*b^3)*f*tan(f*x + e)^3 + (a^5 - 2*a^4*b + a^3*b^2)*f*tan(f*x + e))]

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)**2/(a+b*tan(f*x+e)**2)**2,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]  time = 1.41246, size = 231, normalized size = 1.8 \begin{align*} \frac{\frac{{\left (5 \, a b^{2} - 3 \, b^{3}\right )}{\left (\pi \left \lfloor \frac{f x + e}{\pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (b\right ) + \arctan \left (\frac{b \tan \left (f x + e\right )}{\sqrt{a b}}\right )\right )}}{{\left (a^{4} - 2 \, a^{3} b + a^{2} b^{2}\right )} \sqrt{a b}} - \frac{2 \,{\left (f x + e\right )}}{a^{2} - 2 \, a b + b^{2}} - \frac{2 \, a b \tan \left (f x + e\right )^{2} - 3 \, b^{2} \tan \left (f x + e\right )^{2} + 2 \, a^{2} - 2 \, a b}{{\left (b \tan \left (f x + e\right )^{3} + a \tan \left (f x + e\right )\right )}{\left (a^{3} - a^{2} b\right )}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2/(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/2*((5*a*b^2 - 3*b^3)*(pi*floor((f*x + e)/pi + 1/2)*sgn(b) + arctan(b*tan(f*x + e)/sqrt(a*b)))/((a^4 - 2*a^3*
b + a^2*b^2)*sqrt(a*b)) - 2*(f*x + e)/(a^2 - 2*a*b + b^2) - (2*a*b*tan(f*x + e)^2 - 3*b^2*tan(f*x + e)^2 + 2*a
^2 - 2*a*b)/((b*tan(f*x + e)^3 + a*tan(f*x + e))*(a^3 - a^2*b)))/f